Ackley is a multi-modal function with many local optima. This function is difficult because optimization algorithms can easily be trapped in a local minimum on its way to the global minimizer.
Function definition
3D plot
clc; clear
x = -15:15; y = -15:15;
xy=zeros(length(x)*length(y),2);
cntpts=0;
for ii=1:length(x)
for jj=1:length(y)
cntpts=cntpts+1;
xy(cntpts,1:2)=[x(ii),y(jj)];
end
end
funval = Ackley([xy]);
funval = reshape(funval, length(y),length(x));
surfc(x, y, funval)
Other Useful Functions